package com.xujl.fastlib.base;

/**
 * Created by xujl on 2017/9/19.
 * 布局属性配置类
 */

public class LayoutBuilder {
    /**
     * 导航id，未传时不添加
     */
    private int toolbarId;
    /**
     * 是否使用加载布局
     */
    private boolean isUseStateLayout;
    /**
     * 是否强制添加父布局
     */
    private boolean isAddParentLayout;
    /**
     * 是否使用dataBinding进行加载
     */
    private boolean enableDataBinding;
    /**
     * 导航是否使用dataBinding进行加载
     */
    private boolean enableToolbarDataBinding;
    /**
     * 当前布局Id，未传递时使用默认解析方法反射获得
     */
    private int layoutId;
    /**
     * 多状态布局
     */
    private IStateLayout mStateView;

    private LayoutBuilder () {
        enableDataBinding = true;
        /*
         *  不使用加载布局且不需要toolbar时，不添加父类布局，除非
         *  isAddParentLayout强制设置添加
         */
        isUseStateLayout = true;
        toolbarId = 0;
        enableDataBinding = true;
        enableToolbarDataBinding = true;
    }

    public static LayoutBuilder create () {
        return new LayoutBuilder();
    }

    public LayoutBuilder build () {
        return this;
    }

    public IStateLayout getStateView () {
        return mStateView;
    }

    public LayoutBuilder setStateView (IStateLayout stateView) {
        mStateView = stateView;
        return this;
    }

    public boolean isEnableToolbarDataBinding () {
        return enableToolbarDataBinding;
    }

    public LayoutBuilder setEnableToolbarDataBinding (boolean enableToolbarDataBinding) {
        this.enableToolbarDataBinding = enableToolbarDataBinding;
        return this;
    }

    public int getToolbarId () {
        return toolbarId;
    }

    public LayoutBuilder setToolbarId (int toolbarId) {
        this.toolbarId = toolbarId;
        return this;
    }

    public boolean isUseStateLayout () {
        return isUseStateLayout;
    }

    public LayoutBuilder setUseStateLayout (boolean isUseStateLayout) {
        this.isUseStateLayout = isUseStateLayout;
        return this;
    }

    public boolean isAddParentLayout () {
        return isAddParentLayout;
    }

    public LayoutBuilder setAddParentLayout (boolean addParentLayout) {
        isAddParentLayout = addParentLayout;
        return this;
    }

    public boolean isEnableDataBinding () {
        return enableDataBinding;
    }

    public LayoutBuilder setEnableDataBinding (boolean enableDataBinding) {
        this.enableDataBinding = enableDataBinding;
        return this;
    }

    public int getLayoutId () {
        return layoutId;
    }


    public LayoutBuilder setLayoutId (int layoutId) {
        this.layoutId = layoutId;
        return this;
    }
}
